{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item" >

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <input type="text"  name="match_start_time" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="赛事开始时间"/>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <input type="text"  name="match_end_time" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="赛事结束时间"/>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <input type="text"  name="apply_start_time" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="赛事报名开始时间"/>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <input type="text"  name="apply_end_time" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="赛事报名结束时间"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <input type="text" id="keyword" class="layui-input search" name="keyword" placeholder="赛事ID/名称/组委会"/>
                        </div>

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">
                            <select name="match_status" lay-search="">
                                <option  value="">全部状态</option>
                                <option  value="1">未开始</option>
                                <option  value="2">进行中</option>
                                <option  value="3">已结束</option>
                                <option  value="4">已取消</option>
                            </select>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--操作框开始-->

                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>

                    <!--图片模板-->
                    <!--<script type="text/html" id="imgTpl">-->
                        <!--<img src="{{d.banner_thumb}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"/>-->
                    <!--</script>-->

                    <!--状态显示模板-->
                    <script type="text/html" id="matchStatus">
                        {{# if(d.match_status == 1){ }}
                        未开始
                        {{# } }}
                        {{# if(d.match_status == 2){ }}
                        进行中
                        {{# } }}
                        {{# if(d.match_status == 3){ }}
                        已结束
                        {{# } }}
                        {{# if(d.match_status == 4){ }}
                        已取消
                        {{# } }}
                    </script>

                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;" onclick="wk.layer_show('生活信息','{:url('matchLife')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="生活信息">生活信息</a>
                        <a href="javascript:;" onclick="wk.layer_show('官方文件','{:url('matchGf')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="官方文件">官方文件</a>
                        <a href="javascript:;" onclick="wk.layer_show('图片','{:url('matchImage')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="图片">图片</a>
                        <a href="javascript:;" onclick="wk.layer_show('视频','{:url('matchVideo')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="视频">视频</a>
                        <a href="javascript:;" onclick="wk.layer_show('临时成绩','{:url('lsMark')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="临时成绩">临时成绩</a>
                        {{# if(d.match_status == 1) { }}
                        <a href="javascript:;" onclick="wk.href('{:url('matchCancel')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="取消比赛">取消比赛</a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Rowing/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                  {type: 'checkbox', fixed: 'left'}
                  {type:'numbers', width: '', title: '序号'}
                , {field: 'match_id', width: 80, title: 'ID', align: 'center'}
                , {field: 'match_title', width: '', title: '赛事名称', align: 'center'}
                , {field: 'match_addr', width: '', title: '赛事地点', align: 'center'}
                , {field: 'match_time', width: '', title: '赛事比赛时间', align: 'center'}
                , {field: 'match_apply_time', width: '', title: '赛事报名时间', align: 'center'}
//                , {field: 'boat_name', width: '', title: '船型', align: 'center'}
                , {field: 'group_name', width: '', title: '组别', align: 'center'}
                , {field: 'match_create_time', width: 160, title: '赛事创建时间', align: 'center'}
                , {field: 'match_status', width: 80, title: '状态', align: 'center', toolbar: '#matchStatus'}
                , {field: 'apply_num', width: 90, title: '报名人数', align: 'center'}
                , {field: 'match_apply_num', width: 90, title: '报到人数', align: 'center'}
                , {field: 'com_name', width: 90, title: '组委会', align: 'center'}
                , {field: 'user_username', width: 90, title: '总裁判', align: 'center'}
                , {field: 'zhong', width: '', title: '终点裁判', align: 'center'}
                , {field: 'bianpai', width: '', title: '编排长', align: 'center'}
                , {field: 'zhuren', width: '', title: '仲裁主任', align: 'center'}
                , {field: 'mishu', width: '', title: '仲裁秘书', align: 'center'}
                , {field: 'hexiao', width: '', title: '竞赛检录', align: 'center'}
                , {field: 'match_cancel_reason', width: '', title: '取消原因', align: 'center'}
                , {fixed: 'right', width: 400, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['match_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>